#include "tcpServer.hpp"
#include "Daemon.hpp"
#include <memory>

std::string func(const std::string &str)
{
    return str;
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        logMessage(Error, "参数不匹配,程序名+端口号");
        exit(USAGE_ERR);
    }
    uint16_t port = atoi(argv[1]);
    std::unique_ptr<ns_tcp::TcpServer> tsvr(new ns_tcp::TcpServer(func, port));

    tsvr->initServer();
    Daemon();
    tsvr->start();
}